﻿using Microsoft.EntityFrameworkCore;
using System;

namespace CarparkIMS_Model
{
    public class IMSContext : DbContext
    {
        public IMSContext(DbContextOptions options) : base(options)
        { }
        //public IMSContext(DbContextOptions<IMSContext> options) : base(options)
        //{ }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer(@"Server=TOPSERVER\DATAGUARD;database=llqqCarSystem;User ID=integration;Password=password;Connect Timeout=2400;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultipleActiveResultSets=true");
            }
        }
        public DbSet<tbDisplayTransaction> tbDisplayTransaction { get; set; }
        public DbSet<tbDoorStatus> tbDoorStatus { get; set; }
        public DbSet<tbTransaction> tbTransaction { get; set; }
        public DbSet<llqqPlateLog> llqqPlateLog { get; set; }
        public DbSet<llqqPlateMapping> llqqPlateMapping { get; set; }
        public DbSet<llqqCameraDoorMapping> llqqCameraDoorMapping { get; set; }
        public DbSet<llqqNumberPlate> llqqNumberPlate { get; set; }
        public DbSet<tbDoor> tbDoor { get; set; }
        public DbSet<tbUser> tbUser { get; set; }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<tbDisplayTransaction>().ToTable("tbDisplayTransaction");
            modelBuilder.Entity<tbDoorStatus>().ToTable("tbDoorStatus");
            modelBuilder.Entity<tbTransaction>().ToTable("tbTransaction");
            modelBuilder.Entity<llqqPlateLog>().ToTable("llqqPlateLog");
            modelBuilder.Entity<llqqCameraDoorMapping>().ToTable("llqqCameraDoorMapping");
            modelBuilder.Entity<llqqNumberPlate>().ToTable("llqqNumberPlate");
            modelBuilder.Entity<tbDoor>().ToTable("tbDoor");
            modelBuilder.Entity<tbUser>().ToTable("tbUser");
        }
    }
}
